﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartSpace.Core
{
    /// <summary>
    /// 任务只相对于流程而存在
    /// </summary>
    public class Task
    {
        /// <summary>
        /// 编号
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 显示信息
        /// </summary>
        public string Caption { get; set; }

        /// <summary>
        /// 接收者
        /// </summary>
        public Guid ReceiverId { get; set; }

        /// <summary>
        /// 发送者
        /// </summary>
        public Guid SenderId { get; set; }

        /// <summary>
        /// 发送时间
        /// </summary>
        public DateTime SendTime { get; set; }

        /// <summary>
        /// 是否查看
        /// </summary>
        public bool IsReaded { get; set; }

        /// <summary>
        /// 流程实例编号
        /// </summary>
        public Guid WorkflowInstanceId { get; set; }

        public Task()
        {
        }

        public Task(string caption, Guid instanceId, Guid fromUserId, Guid toUserId)
        {
            this.Id = Guid.NewGuid();
            this.SendTime = DateTime.Now;
            this.IsReaded = false;
            this.Caption = caption;
            this.WorkflowInstanceId = instanceId;
            this.ReceiverId = toUserId;
            this.SenderId = fromUserId;
        }
    }
}
